﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ctrl="clr-namespace:Waf.DotNetPad.Presentation.Controls">

    <Style x:Key="DialogButton" TargetType="Button">
        <Setter Property="MinWidth" Value="75"/>
        <Setter Property="MinHeight" Value="23"/>
        <Setter Property="Margin" Value="11,11,0,0"/>
    </Style>
    
    <Style x:Key="MenuButton" TargetType="ButtonBase">
        <Setter Property="Foreground" Value="{StaticResource DarkForeground}"/>
        <Setter Property="Background" Value="{StaticResource DarkBackground}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Margin" Value="0,0,1,0"/>
        <Setter Property="Padding" Value="7,0"/>
        <Setter Property="Height" Value="35"/>
        <Setter Property="MinWidth" Value="73"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <ContentControl Content="{TemplateBinding ctrl:IconInfo.Icon}" Focusable="False" Margin="0,0,5,0">
                            <ContentControl.Style>
                                <Style TargetType="ContentControl">
                                    <Style.Triggers>
                                        <Trigger Property="Content" Value="{x:Null}">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                        </Trigger>
                                        <Trigger Property="IsEnabled" Value="False">
                                            <Setter Property="Opacity" Value="0.65"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </ContentControl.Style>
                        </ContentControl>
                        <TextBlock Text="{Binding}" TextAlignment="Center" TextWrapping="Wrap"/>
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">
                    <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                        <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" 
                                          ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" 
                                          Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" TargetName="border" Value="{StaticResource DarkBorderBrush}"/>
                            <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource LightForeground}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" TargetName="border" Value="{StaticResource ActiveBackground}"/>
                            <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource ActiveForeground}"/>
                        </Trigger>
                        <Trigger Property="ToggleButton.IsChecked" Value="True">
                            <Setter Property="Background" TargetName="border" Value="{StaticResource ActiveBackground}"/>
                            <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource ActiveForeground}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="#FF838383"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="VerticalMenuButton" TargetType="ButtonBase" BasedOn="{StaticResource MenuButton}">
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="Margin" Value="0,0,0,1"/>
    </Style>
    
</ResourceDictionary>